package tree;

/**
 * Description:
 * Author:    Dane
 * CreateTime:2024/8/24-下午12:03
 * Since  :   1.0
 * Version:   1.0
 */
public class BinaryTree {
    public void setRoot(HeroNode root) {
        this.root = root;
    }

    public HeroNode root;


    public void preOrder() {
        if (this.root != null) {
            this.root.preOrder();
        }
        System.out.println("no root node");
    }

    public void midOrder() {
        if (this.root != null) {
            this.root.midOrder();
        }
        System.out.println("no root node");
    }

    public void postOrder() {
        if (this.root != null) {
            this.root.postOrder();
        }
        System.out.println("no root node");
    }

    public HeroNode preSearch(int no) {
        if (this.root != null) {
            return this.root.preSearch(no);
        }
        return null;

    }

    public HeroNode midSearch(int no) {
        if (this.root != null) {
            return this.root.midSearch(no);
        }
        return null;

    }

    public HeroNode postSearch(int no) {
        if (this.root != null) {
            return this.root.postSearch(no);
        }
        return null;

    }

    public void delNo(int no) {


        if (this.root != null) {
            this.root.delNo(no);
        }
        System.out.println("the root node is null");

    }


}
